<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="/ssm01/js/jquery.min.js"></script>
<script type="text/javascript" >
  $(document).ready(function(){
	  $("#btn2").click(function(){
		   $("#form1").attr("action","/ssm01/emp/toAddDept");
	       $("#form1").submit(); 
	   });
	  
	  $("#btn1").click(function(){
		  $("#form1").attr("action","/ssm01/emp/toAddEmp");
		  $("#form1").submit(); 
	  })
  })
</script>
</head>
<body>
<form action="" method="post" id="form1">
<input type="button" value="添加员工" id="btn1">
<input type="button" value="添加部门" id="btn2">
<table border="1" width="800" height="100">
<tr>
<td>选择</td>
<td>姓名</td>
<td>部门</td>
<td>生日</td>
<td>性别</td>
<td>头像</td>
<td>操作</td>
</tr>
<c:forEach items="${list }" var="emp">
<tr>
<td><input type="checkbox" name="cb" value="${emp.id}"></td>
<td>${emp.ename}</td>
<td>${emp.dept.dname}</td>
<td><f:formatDate value="${emp.birthday }" pattern="yyyy-MM-dd"/></td>
<td>${emp.sex=="1"?'男':'女' }</td>
<td><img width="80" height="60" alt="" src="http://localhost:8080${emp.photo }"></td>
<td><a href="/ssm01/emp/init?id=${emp.id }">编辑</a>
<a href="/ssm01/emp/delete?id=${emp.id }">删除</a></td>
</tr>
</c:forEach>
</table>
</form>
</body>
</html>